package com.googlecode.astoolkit.vo {


	public dynamic class ParamsObject extends Object {
		
		private var _params:Object = new Object();
		private var _length:uint = 0;

		public function ParamsObject(params:Object=null) {
			super();
			if (params) {
				for(var p:*in params) {
					_params[p] = params[p];
					_length++;
				}
			}
			
		}
		
		//
		public function getParams(sep:String="&", equalSep:String="="):String {
			var string:String = "";
			for (var p:* in _params) {
				string += p + equalSep + _params[p] + sep;
			}
			if(string.indexOf(sep)>0){
				string = string.substr(0, -1);  
			}
			return string;
		}
		
		//
		public function get length():uint{
			return _length;
		}
		
		public function toString():String{
			var string:String = "[ParamsObject ";
			for(var i:String in _params){
				string += i + ":" + _params[i] + " ";
			}
			string += "]";
			return string;
		}

	}
}